﻿using EfCore.Core;
using EfCore.Data.Models.Mapping;
using Microsoft.EntityFrameworkCore;

namespace EfCore.Data
{
    public class ApplicationContext
       :DbContext
    {
        public ApplicationContext(DbContextOptions options)
            :base(options)
        {}
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new ProvinceMap());
            base.OnModelCreating(modelBuilder);
        }
        public virtual DbSet<Province> Province { get; set; }
        public virtual DbSet<City> City { get; set; }
        public virtual DbSet<Company> Company { get; set; }
        public virtual DbSet<CityCompany> CityCompany { get; set; }
    }
}
